package com.zygh.dlqwservice.module.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zygh.dlqwservice.common.constant.EmployeeResponseCodeConst;
import com.zygh.dlqwservice.common.pcdomain.ResponseDTO;
import com.zygh.dlqwservice.module.entity.Jobs;
import com.zygh.dlqwservice.module.entity.JobsUser;
import com.zygh.dlqwservice.module.entity.vo.PositionRelationAddVO;
import com.zygh.dlqwservice.module.mapper.JobsUserMapper;
import com.zygh.dlqwservice.module.service.IJobsUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author lee
 * @since 2020-12-24
 */
@Service
public class JobsUserServiceImpl extends ServiceImpl<JobsUserMapper, JobsUser> implements IJobsUserService {
    @Autowired
    private JobsUserMapper jobsUserMapper;

    @Override
    public ResponseDTO addJobsUser(JobsUser jobsUser) {
        JobsUser jobsUser1 = jobsUserMapper.findJobsUser(jobsUser);
        if (jobsUser1 != null) {
            return ResponseDTO.wrap(EmployeeResponseCodeConst.JOBS_USER_ERROR);
        }
        jobsUserMapper.insert(jobsUser);
        return ResponseDTO.succ();
    }

    @Override
    public ResponseDTO batchJobsUser(PositionRelationAddVO positionRelationAddVO) {
        jobsUserMapper.batchJobsUser(positionRelationAddVO);
        return ResponseDTO.succ();
    }


}
